package com.zyg.apart.service.impl;

import java.util.List;
import java.util.Map;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zyg.apart.mapper.FlatplayMapper;
import com.zyg.apart.model.Flatplay;
import com.zyg.apart.service.FlatplayService;
import com.zyg.apart.util.Const;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class FlatplayServiceImpl implements FlatplayService {

	@Autowired
	private FlatplayMapper flatplayMapper;


	@Override
	public PageInfo<Map<String, Object>> getAllPlay(Integer currentPage) {
		PageHelper.startPage(currentPage, Const.pageSize);
		List<Map<String,Object>> list = flatplayMapper.getAllPlay();
		PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(list);
		return pageInfo;
	}

	@Override
	public Flatplay getPlayById(Integer id) {
		return flatplayMapper.getPlayById(id);
	}

	@Override
	public int editPlay(Flatplay flatplay) {
		return flatplayMapper.editPlay(flatplay) ;
	}

	@Override
	public int addPlay(Flatplay flatplay) {
		return flatplayMapper.addPlay(flatplay);
	}

	@Override
	public int delPlayById(Integer id) {
		return flatplayMapper.delPlayById(id);
	}
}
